function create-account ([string]$accountName, [string]$password) {
	$hostname = hostname
	$comp = [adsi] "WinNT://$hostname"
	$user = $comp.Create("User", $accountName)
	$user.SetPassword($password)
	$user.SetInfo()
}

function set-UserPasswordExpires ([string]$accountName, [bool]$expires) {
	$wmiuser = Get-WmiObject -class "Win32_UserAccount" -filter "name='$accountName'"
	$wmiuser.PasswordExpires = $expires
	$wmiuser.Put()
	$wmiuser.PasswordExpires
}

function get-UserExists([string]$accountName) {
	$wmiuser = Get-WmiObject -class "Win32_UserAccount" -filter "name='$accountName'"
	if ($wmiuser)
	{
		return $TRUE
	}
	else
	{
		return $FALSE
	}
}

if (!(get-UserExists PHPDemoUser))
{
	create-account PHPDemoUser Passw0rd!
	set-UserPasswordExpires PHPDemoUser $FALSE
}
else
{
	Write-Output "The user account exists."
}
